#include<cstdio>
int n,m,T;
int x1[505][505],x2[505][505];
int qx1[505],qx2[505];
int k;
int x3[505],p[505],t[505];
int ans=0x3f3f3f3f;
inline int min(int x,int y){return x<y?x:y;}
inline void dfs(int x,int y){
	for(int i=1;i<n;++i)
		for(int j=1;j<=n;++j)
			for(int gg=1;gg<=k;++gg)
				ans=min(ans,qx1[i]+qx2[j]+x3[gg]);
}
int main(){
	freopen("traffic.in","r",stdin);
	freopen("traffic.out","w",stdout);
	scanf("%d%d%d",&n,&m,&T);
	for(int i=1;i<n;++i)
		for(int j=1;j<=m;++j){
			scanf("%d",&x1[i][j]);
			qx1[i]+=x1[i][j];
		}
	for(int i=1;i<=n;++i)
		for(int j=1;j<m;++j){
			scanf("%d",&x2[i][j]);
			qx2[i]+=x2[i][j];
		}
	while(T--){
		scanf("%d",&k);
		for(int i=1;i<=k;++i)
			scanf("%d%d%d",x3+i,p+i,t+i);
		if(k==2&&t[2]==t[1]){
			printf("0\n");
			continue;
		}
		if(k==2){
			if(t[1]+t[2]==2*m+n+1)
				printf("%d\n",qx1[min(t[1],t[2])]);
			if(t[1]+t[2]==3*m+2*n+1)
				printf("%d\n",qx2[min(t[1],t[2])-m]);
		}
		ans=0x3f3f3f3f;
		dfs(1,1);
		printf("%d\n",ans);
	}
	return 0;
}
